// 存储常用的常量


/**
 * 网格不同剖分层级对应最小经差（0层至25层）
 */
const minLongitudeDiff = [
  90,
  45,
  22.5,
  11.25,
  5.625,
  2.8125,
  1.40625,
  0.703125,
  0.3515625,
  0.17578125,
  0.087890625,
  0.0439453125,
  0.02197265625,
  0.010986328125,
  0.0054931640625,
  0.00274658203125,
  0.001373291015625,
  0.0006866455078125,
  0.00034332275390625,
  0.000171661376953125,
  0.0000858306884765625,
  0.00004291534423828125,
  0.000021457672119140625,
  0.000010728836059570312,
  0.000005364418029785156,
  0.000002682209014892578,
]



/**
 * 网格不同层级对应高度差（从0层开始）
 */
const tileHeightInterval = [
  614400,
  307200,
  153600,
  76800,
  38400,
  19200,
  9600,
  4800,
  2400,
  1200,
  600,
  300,
  150,
  75,
  37.5,
  18.75,
  9.375,
  4.6875,
  2.34375,
  1.171875,
  0.585938,
  0.292969,
  0.146484,
  0.073242,
  0.036621,
  0.01831
];

/**
 * 预先将1 / tileHeight计算出来作为常数存储依次来加速
 */
const oneTileHeightNumber = [
  0.0000016276,
  0.0000032552,
  0.0000065104,
  0.0000130208,
  0.0000260417,
  0.000052084,
  0.000104167,
  0.000208333,
  0.000416666,
  0.000833333,
  0.0016666667,
  0.00333333,
  0.00666667,
  0.013333333,
  0.0266666667,
  0.053333333,
  0.106666667,
  0.213333333,
  0.42666666,
  0.8533333,
  1.70666666,
  3.413333333,
  6.8266666667,
  13.6533333,
  27.30666666,
  54.61333333,
  109.2266666,
  218.453333,
  436.90666667,
  873.8133333,
  1747.62666
];

/**
 * 退化网格行数(北半球为例)
 */
const degenerateRow  = 
  [
    0,
    1,
    3,
    7,
    15,
    31,
    63,
    127,
    255,
    511,
    1023,
    2047,
    4095,
    8191,
    16383,
    32767,
    65535,
    131071,
    262143,
    524287,
    1048575,
    2097151,
    4194303,
    8388607,
    16777215,
    33554431,
    67108863,
    134217727,
    268435455,
    536870911,
    1073741823
  ];


/**
 * 退化网格行数(北半球为例，同时为了比较方便，这里进行了 + 1)
 */
const degenerateSouthEdge = [
  45.0,
  67.5,
  78.75,
  84.375,
  87.1875,
  88.59375,
  89.296875,
  89.6484375,
  89.82421875,
  89.912109375,
  89.9560546875,
  89.9780273438,
  89.9890136719,
  89.9945068359,
  89.9972534180,
  89.9986267090,
  89.9993133545,
  89.9996566772,
  89.9998283386,
  89.9999141693,
  89.9999570847,
  89.9999785423,
  89.9999892712,
  89.9999946356,
  89.9999973178,
  89.9999986589,
  89.9999993294,
  89.9999996647,
  89.9999998324,
  89.9999999162
]

export { minLongitudeDiff, tileHeightInterval, oneTileHeightNumber, degenerateRow, degenerateSouthEdge };
